package inits

import (
	"fmt"
	"github.com/elastic/go-elasticsearch/v7"
	"video-srv/basic/config"
	"video-srv/basic/global"
)

func InitEs() {
	var err error
	cfg := elasticsearch.Config{
		Addresses: []string{
			config.Config.Es.Address,
		},
	}
	global.Es, err = elasticsearch.NewClient(cfg)
	if err != nil {
		panic(err)
	}
	fmt.Println("es连接成功")
}
